-content_for :modal_title do
  -if f.object.new_record?
    Create a new control
  -else
    Edit control

.row-fluid
  .span8
    .row-fluid
      .span3{ :class => error_class(f, :program) }
        =f.label :program_id
        =f.collection_select :program_id, Program.all, :id, :slug, { :include_blank => true }, { :class => 'input-small' }
        =error_messages_inline(f, :program)

      .span3{ :class => error_class(f, :slug) }
        =f.label :slug, "Code"
        =f.text_field :slug, :class => 'inputtext-small'
        =error_messages_inline(f, :slug)

      .span3.disabled{ :class => error_class(f, :effectivedate) }
        %label{:for => "control-effectivedate"} Effective Date
        .date{"data-date" => "02-12-12", "data-date-format" => "dd-mm-yy"}
          %input#control-effectivedate.input-mini{:size => "16", :type => "text", :name => 'control[effectivedate]', :value => nil, :'data-toggle' => 'datepicker'}
            %span.add-on
              %i.calendar
        =error_messages_inline(f, :effectivedate)

      .span3.disabled{ :class => error_class(f, :version) }
        %label{:for => "control-version"} Version
        %input#control-version.input-supermini{:name => 'control[version]', :placeholder => "SOX", :type => "text"}
        =error_messages_inline(f, :version)

    .row-fluid
      .span3.disabled{ :class => error_class(f, :type) }
        %label{:for => 'control-type'} Type
        %select#control-type.input-small{:name => 'control[type]', :value => nil}
          %option Company
        =error_messages_inline(f, :type)

      .span3.disabled{ :class => error_class(f, :kind) }
        %label{:for => 'control-kind'} Kind
        %select#control-kind.input-small{:name => 'control[kind]', :value => nil}
          %option Preventative
        =error_messages_inline(f, :kind)

      .span6.disabled{ :class => error_class(f, :means) }
        %label{:for => 'control-means'} Means of Operation
        %select#control-means.span12{:name => 'control[means]', :value => nil}
          %option Manual w/ Segregation of Duties
        =error_messages_inline(f, :means)

    .row-fluid
      .span9{ :class => error_class(f, :title) }
        %label{:for => 'control-title'} Title
        %input#control-title.span12{:placeholder => "Title Goes Here", :type => "text", :name => 'control[title]', :value => f.object.title}
        =error_messages_inline(f, :title)

      .span3.disabled{ :class => error_class(f, :status) }
        %label{:for => 'control-status'} Status
        %select#control-status.input-small{:name => 'control[status]', :value => nil}
          %option Deprecated
          %option Open
        =error_messages_inline(f, :status)

  #categorylist.span4.well.disabled{ :class => error_class(f, :categories) }
    %label{:for => 'control-categories'} Categories
    - category_list = [['Access Control', ['Access Management', 'Authorization', 'Authentication']], ['Change Management', ['Segregation of Duties', 'Configuration Management']], ['Business Continuity', ['Disaster Recovery', 'Physical Security']], ['Governance', ['Training', 'Policies & Procedures', 'Monitoring']]]
    %select{:multiple => "multiple", :name => 'control[categories]'}
      -category_list.each do |category_label, categories|
        %optgroup{ :label => category_label }
          -categories.each do |category|
            %option{ :value => category }=category
    =error_messages_inline(f, :categories)

.row-fluid
  %label{:for => "control-description"} Description
.row-fluid
  .span12.well{ :class => error_class(f, :description) }
    %textarea#control-description.span12{:placeholder => "", :rows => "4", :name => 'control[description]', :value => f.object.description}=f.object.description
    =error_messages_inline(f, :description)

%br
.row-fluid
  .span12.disabled{ :class => error_class(f, :url) }
    %label{:for => 'control-url'} URL
    %input#control-url.span12{:placeholder => "http://", :type => "text", :name => 'control[url]', :value => nil}
    =error_messages_inline(f, :url)

-if !f.object.new_record?
  =render :partial => 'shared/object_info', :locals => { :object => f.object, :approved => false }
